"use strict";
console.log('---------------------接口interface混入--------------------');
let myName = {
    name: '奇奇'
};
let myAge = {
    age: 16
};
let myHobby = {
    hobby: ['打游戏', '按摩']
};
let hqq = Object.assign(myName, myAge, myHobby);
console.log('hqq:', hqq);
console.log('---------------------类Class混入--------------------');
// 类的混入
class A {
    //   constructor(flag: boolean) {
    //     this.flag = flag
    //   }
    changeFlag() {
        this.flag = !this.flag;
    }
}
class B {
    //   constructor(name: string) {
    //     this.name = name
    //   }
    getName() {
        return this.name;
    }
}
class AandB {
    constructor() {
        this.flag = false;
        this.name = '奇奇';
        //   constructor(changeFlag: any, getName: any) {
        //     this.changeFlag = changeFlag
        //     this.getName = getName
        //   }
    }
}
function mixins(curCl, itemCls) {
    itemCls.forEach((item) => {
        // console.log('item:', item)
        // console.log('prototype:', Object.getOwnPropertyNames(item.prototype))
        Object.getOwnPropertyNames(item.prototype).forEach((name) => {
            curCl.prototype[name] = item.prototype[name];
        });
    });
}
mixins(AandB, [A, B]);
let andb = new AandB();
console.log(andb.getName());
console.log(andb.flag);
console.log(andb.changeFlag());
console.log(andb.flag);
